import gdb

# A gdb.Breakpoint that will be set by a GoldenRunManager and will inform
# a GoldenRunDriver that it exited the fault zone (that is, the range of PCs in which
# we'll be injecting faults).
class EndBreakpoint(gdb.Breakpoint):
    def __init__(self, spec, goldenRunDriver):
        super(EndBreakpoint, self).__init__(spec)
        self.goldenRunDriver = goldenRunDriver

    def stop(self):
        self.goldenRunDriver.setInFaultZone(False)

        return True  # Stop at this breakpoint.
